<template>
  <view>
    <view class="navbar">
      <u-icon name="arrow-left" color="#191919" size="20" @click="goBack()" class="back-box"></u-icon>
      <view class="title">审批</view>
    </view>
    <view class="content">
      <view class="basic-info">
        <u--form labelPosition="left" :model="form" ref="form">
          <u-form-item label="审批意见" prop="flag" borderBottom labelWidth="200rpx" required>
            <u-radio-group v-model="form.flag" placement="row" activeColor="#F3360D" @change="radioChange">
              <u-radio :customStyle="{ marginRight: '8px' }" v-for="(item, index) in flagList" :key="index"
                :label="item.name" :name="item.value">
              </u-radio>
            </u-radio-group>
          </u-form-item>
          <u-form-item label="备注" prop="contactUser" borderBottom labelWidth="200rpx">
          </u-form-item>
          <u--textarea v-model="form.comment" placeholder="请输入备注" confirmType="done"></u--textarea>
        </u--form>
        <view class="submit-btn" @click.stop="$noMultipleClicks(submit)">
          <u-button type="primary" size="large" :custom-style="{ height: '98rpx' }" text="提交"></u-button>
        </view>


      </view>
    </view>
  </view>
</template>

<script>
  import { corpSubmit } from "@/api/cockpit/need";
  export default {
    props: {
      scrollHeight: {
        type: String,
        default: "90%",
      },
    },
    components: {},
    data() {
      return {
        noClick: true,
        instanceId: '',
        form: {
          flag: 1,
        },
        //  群组
        flagList: [
          {
            name: "同意",
            value: 1,
            disabled: false,
          },
          {
            name: "不同意",
            value: 0,
            disabled: false,
          },
        ],
      };
    },
    onLoad(option) {
      this.instanceId = option.instanceId;
    },
    onShow() {


    },
    methods: {
      goBack() {
        uni.navigateBack();
      },
      async submit() {
        this.form.instanceId = this.instanceId;
        let res = await corpSubmit(this.form);
        if (res.code == 200) {
          this.$modal.msgSuccess('审核成功');
          setTimeout(() => {
            // 返回之前页面
            this.$tab.reLaunch("/pages/need/index");
          }, 2000);
        }
      }

    },
  };
</script>

<style scoped lang="less">
  /deep/.u-textarea {
    border-radius: 0%;
  }

  /deep/.uni-textarea-textarea {
    font-size: 34rpx;
    color: #333333;
  }

  .navbar {

    .header-info {
      display: flex;
      height: 90rpx;
      line-height: 90rpx;
      margin-top: 86rpx;

      .u-icon {
        width: 30%;
        padding-left: 25rpx;
      }

      .title {
        font-size: 36rpx;
        font-weight: 500;
        color: #FFFFFF;
        text-align: center;
        width: 40%;
      }
    }
  }

  .submit-btn {
    background-color: #ffffff;
    padding: 24rpx;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
  }


  .content {
    background: #ffffff;
    margin: 146rpx 20rpx 20rpx 20rpx;
    padding: 10px;
    border-radius: 16rpx;
    min-height: calc(100vh - 176rpx);

    .basic-info {
      background: #ffffff;
      padding: 0 34rpx;

      .header-title {
        font-size: 36rpx;
        line-height: 50rpx;
        font-weight: bold;
        color: #666666;
        padding: 24rpx 0;
        border-bottom: 1px solid #E8E8E8;
      }

      .content-info {
        font-size: 34rpx;
        line-height: 50rpx;
        color: #666666;
        padding: 40rpx 0;
      }
    }

    .sp-title {
      font-size: 30rpx;
      color: #999999;
      background: #f2f2f2;
      padding: 0 34rpx;
      height: 74rpx;
      line-height: 74rpx;
    }

    .apply-info {
      background: #ffffff;
    }

    .save-btn {
      background: #ffffff;
      position: fixed;
      width: 100%;
      bottom: 20rpx;

      .btn {
        display: flex;
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translate(-50%, -10%);

        /deep/.u-button__text {
          font-size: 36rpx !important;
        }
      }

    }


    .cancel-btn {
      background: #FFFFFF;
      color: #333333;
      border-radius: 8rpx 8rpx 8rpx 8rpx;
      opacity: 1;
      border: 2rpx solid #E5E5E5;
      margin-right: 24rpx;
    }




  }
</style>